# -*- coding:utf-8 -*-  
import matplotlib.pyplot as plt
plt.plot([1,2,3,5])
plt.ylabel('some numbers')
plt.show()


plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
plt.show()


plt.plot([1,2,3,4], [1,4,9,16], 'ro')    #x,y,type
plt.axis([0, 6, 0, 20])   #x-min,x-max,y-min,y-max
plt.show()


import numpy as np
import matplotlib.pyplot as plt
a = np.arange(5)  
print a
t = np.arange(0., 5., 0.2)   #qidian zhongdian jiange


# red dashes, blue squares and green triangles
plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')   #x,y,type
plt.show()


'''
plt.plot(x, y, linewidth=2.0)

line, = plt.plot(x,y,'-')
line.set_antialiased(False)  #guanbi kangjuchi xiangsu
line.show()

lines = plt.plot(x1, y1, x2, y2)
# use keyword args
plt.setp(lines, color='r', linewidth=2.0)
# or MATLAB style string value pairs
plt.setp(lines, 'color', 'r', 'linewidth', 2.0)

'''


#import numpy as np
#import matplotlib.pyplot as plt
def f(t):
	return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
plt.figure(1)
plt.subplot(211)    #line,list,count
plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
plt.subplot(212)
plt.plot(t2, np.cos(2*np.pi*t2), 'r--')
plt.show()



# Fixing random state for reproducibility
np.random.seed(19680801)

mu, sigma = 100, 15    #zhengtai junzhi ,  biaozhuncha
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)    #x,width,every list width,color,toumingdu
#y = mlab.normpdf(bins, mu, sigma)    bijin quxian

plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()




ax = plt.subplot(111)

t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2*np.pi*t)
line, = plt.plot(t, s, lw=2)

plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),             #test，head，foot(word)
            arrowprops=dict(facecolor='black', shrink=0.05),      #color，width
            )

plt.ylim(-2,2)
plt.show()





from matplotlib.ticker import NullFormatter  # useful for `logit` scale

# Fixing random state for reproducibility
np.random.seed(19680801)

# make up some data in the interval ]0, 1[
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
y = y[(y > 0) & (y < 1)]
y.sort()
x = np.arange(len(y))

# plot with various axes scales
plt.figure(1)

# linear
plt.subplot(221)
plt.plot(x, y)
plt.yscale('linear')
plt.title('linear')
plt.grid(True)


# log
plt.subplot(222)
plt.plot(x, y)
plt.yscale('log')
plt.title('log')
plt.grid(True)


# symmetric log
plt.subplot(223)
plt.plot(x, y - y.mean())
plt.yscale('symlog', linthreshy=0.01)
plt.title('symlog')
plt.grid(True)

# logit
plt.subplot(224)
plt.plot(x, y)
plt.yscale('logit')
plt.title('logit')
plt.grid(True)
# Format the minor tick labels of the y-axis into empty strings with
# `NullFormatter`, to avoid cumbering the axis with too many labels.
plt.gca().yaxis.set_minor_formatter(NullFormatter())
# Adjust the subplot layout, because the logit one may take more space
# than usual, due to y-tick labels like "1 - 10^{-3}"
plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,
                    wspace=0.35)

plt.show()





#plt.rcParams['font.sas-serig']=['SimHei'] yonglai xianshi zhengchang de zhongwen
#plt.rcParams['axes.unicode_minus']=False yonglai xianshi zhengchang de fuhao

#http://www.cnblogs.com/zhizhan/p/5615947.html










